/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: mirac
 * Date: 2025-04-17
 * Time: 19:43
 */
public class main {
    public static void main(String[] args) {
        int flag = 1;//计算符号
        double sum = 0; //求和
        for(int i = 1; i <= 100; i++){
            sum += ((1 * 1.0) / i) * flag;
            flag = -flag; //实现奇偶项符号的转变。
        }
        System.out.println(sum);
    }
}
